package org.easy.baiducensor;

import com.baidu.aip.contentcensor.AipContentCensor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 客户端
 */

public class BaiduCensorClient  {


    /// 创建连接
   public BaiduCensorClient(String appId,String apiKey,String secretKey) {
       this.appId = appId;
       this.apiKey = apiKey;
       this.secretKey = secretKey;
   }
    private final String appId;

    private final String apiKey;

    private final String secretKey;


    public AipContentCensor getConnection() {
        AipContentCensor aipContentCensor = new AipContentCensor(appId, apiKey, secretKey);
        ///设置参数
        aipContentCensor.setConnectionTimeoutInMillis(2000);
        aipContentCensor.setSocketTimeoutInMillis(60000);

        System.setProperty("aip.log4j.conf", "path/to/your/log4j.properties");

        return aipContentCensor;

    }

}
